import java.util.Arrays;
import java.util.Scanner;

public class _01背包 {
    static int N = 1010;
    static int[] arr = new int[N];
    static int[] s = new int[N];
    static int[] w = new int[N];
    static int[] max = new int[N];
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int v = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            arr[i] = sc.nextInt();
            s[i] = s[i-1]+arr[i];
            w[i] = sc.nextInt();
            max[i] = max[i-1] + w[i];
        }

        System.out.println(Arrays.toString(w));

    /* int value=0;
        for(int i=1;i<=n;i++)
            for(int j=1;j<=i;j++) {
                if(s[i]-s[j-1] <= v) value=Math.max(value,max[i]-max[j-1]);
            }

        System.out.println(value);*/
    }
}
